@extends('admin::layouts.master')

@section('content')
    <form action="{{route('permission',$role['id'])}}" method="post">
        @csrf
        <div class="col-lg-12">
            <div class="card card-flat">
                <div class="card-header">{{$role['title']}}分配权限</div>
            @foreach($permissions as $k=>$v)
                @foreach($v['rules'] as $vv)
                <div class="form-group row pt-1 pb-0">
                    <div class="col-12 col-sm-8 col-lg-6 mt-2">
                        <div class="form-group">

                            @foreach($vv['permissions'] as $vvv)
                            <div>
                                <label class="custom-control custom-checkbox custom-control-inline">
                                    <input type="checkbox" @if($role->hasPermissionTo($vvv['name'])) checked @endif name="name[]"  value="{{$vvv['name']}}" class="custom-control-input is-invalid"><span class="custom-control-label custom-control-color">{{$vvv['title']}}</span>
                                </label>
                            </div>
                            @endforeach

                        </div>
                    </div>
                @endforeach
                </div>
            @endforeach
            </div>
        </div>
        <button type="submit" class="btn btn-space btn-success btn-lg">保存</button>
    </form>
@endsection
